package com.hongyuan.venue.base;

import com.hongyuan.mvvmhabitx.BuildConfig;
import com.hongyuan.mvvmhabitx.base.BaseApplication;
import com.hongyuan.mvvmhabitx.crash.CaocConfig;
import com.hongyuan.mvvmhabitx.utils.KLog;
import com.hongyuan.venue.R;
import com.hongyuan.venue.ui.main.activity.StartupPageActivity;


public class MyAppApplication extends BaseApplication {
    @Override
    public void onCreate() {
        super.onCreate();

        //是否开启打印日志
        KLog.init(BuildConfig.DEBUG);

        //配置全局异常崩溃操作
        CaocConfig.Builder.create()
                .backgroundMode(CaocConfig.BACKGROUND_MODE_SILENT) //背景模式,开启沉浸式
                .enabled(true) //是否启动全局异常捕获
                .showErrorDetails(true) //是否显示错误详细信息
                .showRestartButton(true) //是否显示重启按钮
                .trackActivities(true) //是否跟踪Activity
                .minTimeBetweenCrashesMs(2000) //崩溃的间隔时间(毫秒)
                .errorDrawable(R.mipmap.ic_launcher) //错误图标
                .restartActivity(StartupPageActivity.class) //重新启动后的activity
                .errorActivity(StartupPageActivity.class) //崩溃后的错误activity
                //.eventListener(new YourCustomEventListener()) //崩溃后的错误监听
                .apply();

    }
}
